<template>
    <div class="app-container"  >
        <div  ref="divtest"  id="divtest" >

            <OBJECT id="objocx" classid="CLSID:E8986ABC-EAB5-4CE5-AE8D-1908E00F86D6"></OBJECT>
        </div>

        <el-button   @click.native="getUsbInfo()" >保存修改</el-button>

    </div>
</template>

<script>

 
export default {
    name: 'SystemUser',
    components: {  },
    directives: {   },
    filters: { },
    data() {
        return {
            activeXListener:null
        }
    },
    computed: {

    },
    mounted: function() {
         this.initActiveXObject()

        // let ocxobj = document.getElementById('objocx')
        // ocxobj.attachEvent('GetUkeySN',this.wakeUp)

    },
    created() {
        
         
        //判断登陆类型
        // if(!window.ActiveXObject){
        //     alert("对不起，证书登陆请使用IE浏览器！");
        //     return;
        // }
       

    },
    methods: {
        // function GetUkeySN() {
        // 	var rv = objocx.GetUkeySN();	
        // 	alert(rv);
        // 	UkeySN.value = rv;
        // }
        
        wakeUp(msg) {
            console.log('receive:' + msg)
        },

        initActiveXObject () {

            var scriptStr = document.createElement('script')
            scriptStr.setAttribute('for', 'objocx')
            scriptStr.event = 'GetUkeySN()'
            scriptStr.text = ` ` ;
            scriptStr.appendChild(document.createTextNode(activeXListener.wakeUp()  )  )
            document.getElementById("divtest").appendChild(scriptStr)
             window.activeXListener = this

            // var scriptStr = document.createElement('script')
            // scriptStr.setAttribute('for', 'objocx')
            // scriptStr.event = 'GetUkeySN()'
            // scriptStr.appendChild(document.createTextNode(activeXListener.wakeUp(strMsg)))
            // document.getElementById("divtest").appendChild(scriptStr)
            // window.activeXListener = this
        },
        
        
		

        getUsbInfo(){
            
            // let a = window.objocx ;
            // console.log( a );
            // alert( a.GetUkeySN() 	 );
            
            let b = document.getElementById('objocx') ;
            console.log( b );
            alert( b.GetUkeySN() 	 );
            
        }
        

         
     

    }
}
</script>
<style>

   

</style>
